package cn.itcast.bos.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.domain.base.Area;
import cn.itcast.bos.repository.AreaRepository;
import cn.itcast.bos.service.AreaService;

/**
 * 区域
 * @author Beck
 *
 */
@Service
@Transactional
public class AreaServiceImpl implements AreaService {
	@Autowired
	private AreaRepository areaRepository;

	/**
	 * 批量导入区域信息
	 */
	@Override
	public void batchImprotArea(List<Area> areaList) {
		for (Area area : areaList) {
			areaRepository.save(area);
		}

	}

	/**
	 * 分页查询
	 */
	@Override
	public Page<Area> findByPage(Pageable pageable, Specification<Area> spec) {
		Page<Area> list = areaRepository.findAll(spec, pageable);
		return list;
	}

}
